package java0819;

import javax.swing.tree.TreeNode;
import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.LinkedBlockingQueue;

public class ThreadDemo16 {
    public static void main(String[] args) throws InterruptedException {
        //此处可以看到LinkedBlockingQueue内部时基于链表来实现的
        BlockingQueue<String> queue = new LinkedBlockingQueue<>();
        //put带有阻塞功能，但是offer不带有，使用阻塞功对列一般都是使用put
        queue.put("hello");
        String elem = queue.take();
        System.out.println(elem);
        elem = queue.take();
        System.out.println(elem);
    }














}















